# makefile for macosx

#flags = -msse3 -mfpmath=sse -march=prescott -O3 -Wall -Iode
flags = -Wall -Iode -DDEBUG

headers := $(wildcard *.h)

frameworks := -framework Carbon -framework OpenGL -framework AGL

all : OpenGL.app

opengl : OpenGL OpenGL.app
	open OpenGL.app --wait-apps

% : %.cpp makefile ${headers}
	g++ $< -o $@ ${flags} ${frameworks}

%.app : %
	rm -rf $<.app
	mkdir $<.app
	mkdir $<.app/Contents
	mkdir $<.app/Contents/MacOS
	cp $< $<.app/Contents/MacOS/

.PHONY : opengl

clean:
	rm -f OpenGL
	rm -f *.a
	rm -rf *.app
